namespace Apps.Models.RC
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class Model1 : DbContext
    {
        public Model1()
            : base("name=Model118")
        {
        }

        public virtual DbSet<PL_RC_DETAILS> PL_RC_DETAILS { get; set; }
        public virtual DbSet<PUB_SCHEME> PUB_SCHEME { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<PL_RC_DETAILS>()
                .Property(e => e.AMOUNT)
                .HasPrecision(9, 2);

            modelBuilder.Entity<PL_RC_DETAILS>()
                .Property(e => e.QNET)
                .HasPrecision(9, 2);

            modelBuilder.Entity<PL_RC_DETAILS>()
                .Property(e => e.ST)
                .HasPrecision(5, 2);

            modelBuilder.Entity<PUB_SCHEME>()
                .Property(e => e.COAL_TOTAL)
                .HasPrecision(7, 2);

            modelBuilder.Entity<PUB_SCHEME>()
                .HasMany(e => e.PL_RC_DETAILS)
                .WithMany(e => e.PUB_SCHEME)
                .Map(m => m.ToTable("RC_SCHEME_PLAN").MapLeftKey("SCHEME_ID").MapRightKey("DETAIL_ID"));
        }
    }
}
